﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;

namespace Microsoft.Samples.Office.UnifiedCommunications.Gadget.Config
{
    public class DesktopContactElement : ConfigurationElement
    {
        private static ConfigurationProperty contactId;
        private static ConfigurationProperty sipUri;
        private static ConfigurationProperty displayName;
        private static ConfigurationProperty visible;

        private static ConfigurationPropertyCollection properties;

        public DesktopContactElement()
        {
            contactId = new ConfigurationProperty("contactId", typeof(int), null, ConfigurationPropertyOptions.IsKey);
            sipUri = new ConfigurationProperty("sipUri", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
            displayName = new ConfigurationProperty("displayName", typeof(string), null, ConfigurationPropertyOptions.IsRequired);
            visible = new ConfigurationProperty("visible", typeof(bool), null, ConfigurationPropertyOptions.IsRequired);

            properties = new ConfigurationPropertyCollection();

            properties.Add(contactId);
            properties.Add(sipUri);
            properties.Add(displayName);
            properties.Add(visible);
        }

        [ConfigurationProperty("contactId", IsKey = true, IsRequired = true)]
        public int ContactId
        {
            get { return (int)base[contactId]; }
            set { base[contactId] = value; }
        }

        [ConfigurationProperty("sipUri", IsRequired = true)]
        public string SipUri
        {
            get { return (string)base[sipUri]; }
            set { base[sipUri] = value; }
        }

        [ConfigurationProperty("displayName", IsRequired = true)]
        public string DisplayName
        {
            get { return (string)base[displayName]; }
            set { base[displayName] = value; }
        }

        [ConfigurationProperty("visible", IsRequired = true)]
        public bool Visible
        {
            get { return (bool)base[visible]; }
            set { base[visible] = value; }
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get { return properties; }
        }
    }
}